<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<script><!--#include virtual="js/templateData.js" --></script>

<script id="upgrade-template" type="text/x-handlebars-template">

<h4><a id="upgrade_4_2_0" href="#upgrade_4_2_0">Upgrading to 4.2.0</a></h4>

<h5><a id="upgrade_4_2_0_from" href="#upgrade_4_2_0_from">Upgrading Servers to 4.2.0 from any version 3.3.x through 4.1.x</a></h5>

<h5><a id="upgrade_420_notable" href="#upgrade_420_notable">Notable changes in 4.2.0</a></h5>
<ul>
    <li>
        The <code>--max-partition-memory-bytes</code> option in <code>kafka-console-producer</code>
        is deprecated and will be removed in Kafka 5.0. Please use <code>--batch-size</code> instead.
    </li>
    <li>
        Queues for Kafka (<a href="https://cwiki.apache.org/confluence/x/4hA0Dw">KIP-932</a>) is production-ready in Apache Kafka 4.2. This feature introduces a new kind of group called
        share groups, as an alternative to consumer groups. Consumers in a share group cooperatively consume records from topics, without assigning each partition to just one consumer.
        Share groups also introduce per-record acknowledgement and counting of delivery attempts. Use share groups in cases where records are processed one at a time, rather than as part
        of an ordered stream.
    </li>
    <li>
        The <code>org.apache.kafka.common.header.internals.RecordHeader</code> class has been updated to be read thread-safe. See <a href="https://cwiki.apache.org/confluence/x/nYmhFg">KIP-1205</a> for details.
        In other words, each individual <code>Header</code> object within a <code>ConsumerRecord</code>'s <code>headers</code> can now be safely read from multiple threads concurrently.
    </li>
    <li>
        The <code>org.apache.kafka.disallowed.login.modules</code> config was deprecated. Please use the <code>org.apache.kafka.allowed.login.modules</code>
        instead.
    </li>
    <li>
        The <code>remote.log.manager.thread.pool.size</code> config was deprecated. Please use the <code>remote.log.manager.follower.thread.pool.size</code> instead.
    </li>
    <li>
        The <code>KafkaPrincipalBuilder</code> now extends <code>KafkaPrincipalSerde</code>. Force developer to implement <code>KafkaPrincipalSerde</code> interface for custom <code>KafkaPrincipalBuilder</code>.
        For further details, please refer to <a href="https://cwiki.apache.org/confluence/x/1gq9F">KIP-1157</a>.
    </li>
    <li>The behavior of <code>org.apache.kafka.streams.KafkaStreams#removeStreamThread</code> has been changed. The consumer has no longer remove once <code>removeStreamThread</code> finished.
        Instead, consumer would be kicked off from the group after <code>org.apache.kafka.streams.processor.internals.StreamThread</code> completes its <code>run</code> function.
    </li>
    <li>
        The support for MX4J library, enabled through <code>kafka_mx4jenable</code> system property, was deprecated and will be removed in Kafka 5.0.
    </li>
    <li>
        The <code>PARTITIONER_ADPATIVE_PARTITIONING_ENABLE_CONFIG</code> in <code>ProducerConfig</code> was deprecated and will be removed in Kafka 5.0. Please use the <code>PARTITIONER_ADAPTIVE_PARTITIONING_ENABLE_CONFIG</code> instead.
    </li>
    <li>
        The <code>ConsumerPerformance</code> command line tool has a new <code>--include</code> option that is an alternative to the <code>--topic</code> option.
        This new option allows to pass a regular expression specifying a list of topics to include for consumption, which is useful to test consumer performance across multiple topics or dynamically matching topic sets.
    </li>
    <li>
        The consistency of argument names for the command-line tools has been improved (<a href="https://cwiki.apache.org/confluence/x/DguWF">KIP-1147</a>).
        The deprecated options will be removed in Kafka 5.0.
        <ul>
            <li>
                In <code>kafka-producer-perf-test.sh</code>, <code>--bootstrap-server</code> and <code>--reporting-interval</code> option are added.
            </li>
            <li>
                In <code>kafka-console-consumer.sh</code> and <code>kafka-console-share-consumer.sh</code>, the option <code>--property</code>
                which is used to specify the properties for the formatter is deprecated in favor of <code>--formatter-property</code>.
            </li>
            <li>
                In <code>kafka-console-producer.sh</code>, the option <code>--property</code> which is used to specify properties
                in the form key=value to the message reader is deprecated in favor of <code>--reader-property</code>.
            </li>
            <li>
                In <code>kafka-consumer-perf-test.sh</code> and <code>kafka-share-consumer-perf-test.sh</code>, the option <code>--messages</code>
                is deprecated in favor of <code>--num-records</code> to bring all performance testing tools in line.
            </li>
            <li>
                The option <code>--command-property</code> is used for all command-line tools which accept configuration properties directly on
                the command line. The tools affected are:
                <ul>
                    <li>
                        <code>kafka-console-consumer.sh</code>, <code>kafka-console-producer.sh</code> and
                        <code>kafka-console-share-consumer.sh</code> (<code>--consumer-property</code> and <code>--producer-property</code> are
                        deprecated in favor of <code>--command-property</code>)
                    </li>
                    <li>
                        <code>kafka-producer-perf-test.sh</code> (<code>--producer-props</code> is deprecated in favor of <code>--command-property</code>)
                    </li>
                    <li>
                        <code>kafka-consumer-perf-test.sh</code> and <code>kafka-share-consumer-perf-test.sh</code> gain the
                        <code>--command-property</code> option to bring all performance testing tools in line
                    </li>
                </ul>
            </li>
            <li>
                The option <code>--command-config</code> is used for all command-line tools which accept a file of configuration properties.
                The tools affected are:
                <ul>
                    <li>
                        <code>kafka-cluster.sh</code> (<code>--config</code> is deprecated in favor of <code>--command-config</code>)
                    </li>
                    <li>
                        <code>kafka-console-consumer.sh</code>, <code>kafka-console-producer.sh</code> and
                        <code>kafka-console-share-consumer.sh</code> (<code>--consumer.config</code> and <code>--producer.config</code> are
                        deprecated in favor of <code>--command-config</code>)
                    </li>
                    <li>
                        <code>kafka-consumer-perf-test.sh</code>, <code>kafka-producer-perf-test.sh</code> and
                        <code>kafka-share-consumer-perf-test.sh</code> (<code>--consumer.config</code> and
                        <code>--producer.config</code> are deprecated in favor of <code>--command-config</code>)
                    </li>
                    <li>
                        <code>kafka-verifiable-consumer.sh</code> and <code>kafka-verifiable-producer.sh</code>
                        (<code>--consumer.config</code> and <code>--producer.config</code> are deprecated in favor of <code>--command-config</code>)
                    </li>
                    <li>
                        <code>kafka-leader-election.sh</code> (<code>--admin.config</code> is deprecated in favor of <code>--command-config</code>)
                    </li>
                    <li>
                        <code>kafka-streams-application-reset.sh</code> (<code>--config-file</code> is deprecated in favor of <code>--command-config</code>)
                    </li>
                </ul>
            </li>
        </ul>
    </li>
    <li>
        The <code>num.replica.fetchers</code> config has a new lower bound of 1.
    </li>
    <li>
        Improvements have been made to the validation rules and default values of LIST-type configurations
        (<a href="https://cwiki.apache.org/confluence/x/HArXF">KIP-1161</a>).
        <ul>
            <li>
                LIST-type configurations now enforce stricter validation:
                <ul>
                    <li>Null values are no longer accepted for most LIST-type configurations. Exceptions apply only to
                        configurations that have null as their default value, as users cannot explicitly assign null values
                        in configuration files or through the API.</li>
                    <li>Most LIST-type configurations no longer accept duplicate entries, except in cases where duplicates
                        are explicitly supported. For backward compatibility, if users configure duplicate entries when they
                        are not accepted, duplicate entries will be ignored and a warning will be logged.</li>
                    <li>For certain configurations, an empty list causes the system to malfunction. Therefore, empty
                        lists are no longer allowed for those configurations.</li>
                </ul>
            </li>
            <li>
                Several configurations have been reclassified from STRING-type to LIST-type to better reflect their
                intended use as comma-separated values.
            </li>
            <li>
                Default values for certain configurations have been adjusted to ensure better consistency with related
                settings.
            </li>
            <li>
                <code>cleanup.policy</code> now supports empty values, which means infinite retention.
                This is equivalent to setting <code>retention.ms=-1</code> and <code>retention.bytes=-1</code>
                <br>
                If <code>cleanup.policy</code> is empty and <code>remote.storage.enable</code> is set to true, the
                local log segments will be cleaned based on the values of <code>log.local.retention.bytes</code> and
                <code>log.local.retention.ms</code>.
                <br>
                If <code>cleanup.policy</code> is empty and <code>remote.storage.enable</code> is set to false,
                local log segments will not be deleted automatically. However, records can still be deleted
                explicitly through <code>deleteRecords</code> API calls, which will advance the log start offset
                and remove the corresponding log segments.
            </li>
        </ul>
    </li>
    <li>
        The <code>controller.quorum.auto.join.enable</code> has been added to <code>QuorumConfig</code>, enabling KRaft controllers to automatically join the cluster's voter set,
        and defaults to false.
        For further details, please refer to <a href="https://cwiki.apache.org/confluence/x/nyH1D">KIP-853</a>.
    </li>
    <li>
        The AppInfo metrics will deprecate the following metric names, which will be removed in Kafka 5.0:
        <ul>
            <li><code>[name=start-time-ms, group=app-info, description=Metric indicating start-time-ms, tags={}]</code></li>
            <li><code>[name=commit-id, group=app-info, description=Metric indicating commit-id, tags={}]</code></li>
            <li><code>[name=version, group=app-info, description=Metric indicating version, tags={}]</code></li>
        </ul>
        In addition, the <code>client-id</code> will be added to the tags of these metrics. The new metric names will be:
        <ul>
            <li><code>[name=start-time-ms, group=app-info, description=Metric indicating start-time-ms, tags={client-id=...}]</code></li>
            <li><code>[name=commit-id, group=app-info, description=Metric indicating commit-id, tags={client-id=...}]</code></li>
            <li><code>[name=version, group=app-info, description=Metric indicating version, tags={client-id=...}]</code></li>
        </ul>
        For further details, please refer to <a href="https://cwiki.apache.org/confluence/x/3gn0Ew">KIP-1120</a>.
    </li>
    <li>
        The metrics <code>org.apache.kafka.server:type=AssignmentsManager.QueuedReplicaToDirAssignments</code>,
        <code>org.apache.kafka.storage.internals.log:type=RemoteStorageThreadPool.RemoteLogReaderTaskQueueSize</code>, and
        <code>org.apache.kafka.storage.internals.log:type=RemoteStorageThreadPool.RemoteLogReaderAvgIdlePercent</code>
        have been deprecated and will be removed in Kafka 5.0.

        As replacements, the following metrics have been introduced, which report the same information:
        <code>kafka.server:type=AssignmentsManager.QueuedReplicaToDirAssignments</code>,
        <code>kafka.log.remote:type=RemoteStorageThreadPool.RemoteLogReaderTaskQueueSize</code>, and
        <code>kafka.log.remote:type=RemoteStorageThreadPool.RemoteLogReaderAvgIdlePercent</code>.
        For further details, please refer to <a href="https://cwiki.apache.org/confluence/x/6oqMEw">KIP-1100</a>.
    </li>
    <li>
        A new metric <code>AvgIdleRatio</code> has been added to the <code>ControllerEventManager</code> and <code>MetadataLoader</code> groups. These metrics measure the average idle ratio of their respective event queue threads,
        providing visibility into how much time each component spends waiting for events versus processing them. The metric value ranges from 0.0 (always busy) to 1.0 (always idle).
    </li>
    <li>
        Deprecated <code>org.apache.kafka.streams.KafkaStreams$CloseOptions</code> and its related methods, such as
        <code>KafkaStreams#close(org.apache.kafka.streams.KafkaStreams$CloseOptions)</code>.
        As a replacement, please use <code>org.apache.kafka.streams.CloseOptions</code> and
        <code>KafkaStreams#close(org.apache.kafka.streams.CloseOptions)</code>.
        For further details, please refer to <a href="https://cwiki.apache.org/confluence/x/QAq9F">KIP-1153</a>.
    </li>
    <li>
        A new implementation of <code>ConnectorClientConfigOverridePolicy</code>, <code>AllowlistConnectorClientConfigOverridePolicy</code>,
        has been added. This enables specifying the configurations that connectors can override via <code>connector.client.config.override.allowlist</code>.
        From Kafka 5.0.0, this will be the default <a href="documentation/#connectconfigs_connector.client.config.override.policy">connector.client.config.override.policy</a>
        policy. The <code>PrincipalConnectorClientConfigOverridePolicy</code> policy is now deprecated and will be removed in Kafka 5.0.0.
        For further details, please refer to <a href="https://cwiki.apache.org/confluence/x/2IkvFg">KIP-1188</a>.
    </li>
    <li>
        It is now possible to specify the start time for a Kafka Streams punctuation, instead of relying on the non-deterministic time when you register it.
        For further details, please refer to <a href="https://cwiki.apache.org/confluence/x/9QqWF">KIP-1146</a>.
    </li>
    <li>
        Added an optional <code>--node-id</code> flag to the <code>FeatureCommand</code> command. It specifies the node to describe.
        If not provided, an arbitrary node is used.
    </li>
</ul>

<h4><a id="upgrade_4_1_0" href="#upgrade_4_1_0">Upgrading to 4.1.0</a></h4>

<p><b>Note:</b> Kafka Streams 4.1.0 contains a critical memory leak bug (<a href="https://issues.apache.org/jira/browse/KAFKA-19748">KAFKA-19748</a>) that affects users of range scans and certain DSL operators (session windows, sliding windows, stream-stream joins, foreign-key joins). Users running Kafka Streams should consider upgrading directly to 4.1.1, which includes the fix for it.</p>

<h5><a id="upgrade_4_1_0_from" href="#upgrade_4_1_0_from">Upgrading Servers to 4.1.0 from any version 3.3.x through 4.0.x</a></h5>
    <h5><a id="upgrade_410_notable" href="#upgrade_410_notable">Notable changes in 4.1.0</a></h5>
        <ul>
            <li>
                Apache Kafka 4.1 ships with a preview of Queues for Kafka (<a href="https://cwiki.apache.org/confluence/x/4hA0Dw">KIP-932</a>). This feature introduces a new kind of group called
                share groups, as an alternative to consumer groups. Consumers in a share group cooperatively consume records from topics, without assigning each partition to just one consumer.
                Share groups also introduce per-record acknowledgement and counting of delivery attempts. Use share groups in cases where records are processed one at a time, rather than as part
                of an ordered stream. To enable share groups, use the <code>kafka-features.sh</code> tool to upgrade to <code>share.version=1</code>.
                For more information, please read the <a href="https://cwiki.apache.org/confluence/x/CIq3FQ"> release notes</a>.
            </li>
            <li><b>Common</b>
                <ul>
                    <li>
                        The logger class name for LogCleaner has been updated from <code>kafka.log.LogCleaner</code> to <code>org.apache.kafka.storage.internals.log.LogCleaner</code> in the log4j2.yaml configuration file.
                        Added loggers for <code>org.apache.kafka.storage.internals.log.LogCleaner$CleanerThread</code> and <code>org.apache.kafka.storage.internals.log.Cleaner</code> classes to CleanerAppender.
                    </li>
                    <li>
                        The filename for rotated <code>state-change.log</code> files has been updated from <code>stage-change.log.[date]</code> to <code>state-change.log.[date]</code> in the log4j2.yaml configuration file.
                    </li>
                </ul>
            </li>
            <li><b>Broker</b>
                <ul>
                    <li>
                        The configuration <code>log.cleaner.enable</code> is deprecated. Users should no longer set it to <code>false</code> to prepare for future removal.
                        After the removal, <code>log.cleaner.threads</code> will also have a lower bound of 1.
                        For further details, please refer to <a href="https://cwiki.apache.org/confluence/x/XAyWF">KIP-1148</a>.
                    </li>
                    <li>
                        The KIP-966 part 1: Eligible Leader Replicas(ELR) will be enabled by default on the new clusters.
                        After the ELR feature enabled, the previously set <code>min.insync.replicas</code> value at the broker-level config will be removed.
                        Please set at the cluster-level if necessary.
                        For further details, please refer to <a href="/{{version}}/documentation.html#eligible_leader_replicas">here</a>.
                    </li>
                </ul>
            </li>
            <li><b>Producer</b>
                <ul>
                    <li>The <code>flush</code> method now detects potential deadlocks and prohibits its use inside a callback. This change prevents unintended blocking behavior, which was a known risk in earlier versions.
                    </li>
                </ul>
            </li>
            <li><b>Command</b>
                <ul>
                    <li>The <code>force</code> option of <code>ConfigCommand</code> has been removed, as it has been non-operational since version 0.10.1.0.
                    </li>
                </ul>
            </li>
            <li><b>Admin</b>
                <ul>
                    <li>
                        The <code>listConsumerGroups()</code> and <code>listConsumerGroups(ListConsumerGroupsOptions)</code> methods in <code>Admin</code> are deprecated,
                        and will be removed in the next major version. Use <code>Admin.listGroups(ListGroupsOptions.forConsumerGroups())</code> instead.
                    </li>
                </ul>
            </li>
            <li><b>Kafka Streams</b>
                <ul>
                    <li>
                        The <code>window.size.ms</code> and <code>window.inner.serde.class</code> in <code>StreamsConfig</code> are deprecated.
                        Use the corresponding string constants defined in <code>TimeWindowedSerializer</code>, <code>TimeWindowedDeserializer</code>, <code>SessionWindowedSerializer</code> and <code>SessionWindowedDeserializer</code> instead.
                    </li>
                </ul>
            </li>
        </ul>

<h4><a id="upgrade_4_0_1_from" href="#upgrade_4_0_1_from">Upgrading to 4.0.1</a></h4>

<h5><a id="upgrade_clients_4_0_1" href="#upgrade_clients_4_0_1">Upgrading Clients to 4.0.1</a></h5>

<p><b>For a rolling upgrade:</b></p>

<ol>
    <li>Upgrade the clients one at a time: shut down the client, update the code, and restart it.</li>
    <li>Clients (including Streams and Connect) must be on version 2.1 or higher before upgrading to 4.0. Many deprecated APIs were removed in Kafka 4.0.
        For more information about the compatibility, please refer to the <a href="/{{version}}/documentation/compatibility.html">compatibility matrix</a>
        or <a href="https://cwiki.apache.org/confluence/x/y4kgF">KIP-1124</a>.</li>
</ol>

<h5><a id="upgrade_4_0_1" href="#upgrade_4_0_1">Upgrading Servers to 4.0.1 from any version 3.3.x through 3.9.x</a></h5>

<p>Note: Apache Kafka 4.0 only supports KRaft mode - ZooKeeper mode has been removed. As such, <b>broker upgrades to 4.0.0 (and higher) require KRaft mode and
    the software and metadata versions must be at least 3.3.x</b> (the first version when KRaft mode was deemed production ready). For clusters in KRaft mode
    with versions older than 3.3.x, we recommend upgrading to 3.9.x before upgrading to 4.0.x. Clusters in ZooKeeper mode
    have to be <a href="/{{version}}/documentation.html#kraft_zk_migration">migrated to KRaft mode</a> before they can be upgraded to 4.0.x.
</p>

<p><b>For a rolling upgrade:</b></p>

<ol>
    <li>Upgrade the brokers one at a time: shut down the broker, update the code, and restart it. Once you have done so, the
        brokers will be running the latest version and you can verify that the cluster's behavior and performance meet expectations.
    </li>
    <li>Once the cluster's behavior and performance have been verified, finalize the upgrade by running
        <code>
            bin/kafka-features.sh --bootstrap-server localhost:9092 upgrade --release-version 4.0
        </code>
    </li>
    <li>Note that cluster metadata downgrade is not supported in this version since it has metadata changes.
        Every <a href="https://github.com/apache/kafka/blob/trunk/server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java">MetadataVersion</a>
        has a boolean parameter that indicates if there are metadata changes (i.e. <code>IBP_4_0_IV1(23, "4.0", "IV1", true)</code> means this version has metadata changes).
        Given your current and target versions, a downgrade is only possible if there are no metadata changes in the versions between.</li>
</ol>
    <h5><a id="upgrade_servers_401_notable" href="#upgrade_servers_401_notable">Notable changes in 4.0.1</a></h5>
    <ul>
        <li>
            The filename for rotated <code>state-change.log</code> files has been updated from <code>stage-change.log.[date]</code> to <code>state-change.log.[date]</code> in the log4j2.yaml configuration file.
            See <a href="https://issues.apache.org/jira/browse/KAFKA-19576">KAFKA-19576</a> for details.
        </li>
        <li>
            Kafka Streams include a critical fix to upgrade from <code>KStreams#transformValues()</code> (remove with 4.0.0 release)
            to <code>KStreams#processValues()</code>.
            For more details, see the <a href="/{{version}}/documentation/streams/developer-guide/dsl-api.html#transformers-removal-and-migration-to-processors">migration guide</a>.
        </li>
    </ul>
    <h5><a id="upgrade_servers_400_notable" href="#upgrade_servers_400_notable">Notable changes in 4.0.0</a></h5>
    <ul>
        <li>
            Old protocol API versions have been removed. Users should ensure brokers are version 2.1 or higher before upgrading Java clients
	    (including Connect and Kafka Streams which use the clients internally) to 4.0.
            Similarly, users should ensure their Java clients (including Connect and Kafka Streams) version is 2.1 or higher before upgrading brokers to 4.0.
	    Finally, care also needs to be taken when it comes to kafka clients that are not part of Apache Kafka, please see
            <a href="https://cwiki.apache.org/confluence/x/K5sODg">KIP-896</a> for the details.
        </li>
        <li>
            Apache Kafka 4.0 only supports KRaft mode - ZooKeeper mode has been removed. About version upgrade,
            check <a href="/{{version}}/documentation.html#upgrade_4_0_1">Upgrading to 4.0.1 from any version 3.3.x through 3.9.x</a> for more info.
        </li>
        <li>
            Apache Kafka 4.0 ships with a brand-new group coordinator implementation (See <a href="https://cwiki.apache.org/confluence/x/HhD1D">here</a>).
            Functionally speaking, it implements all the same APIs. There are reasonable defaults, but the behavior of the new
            group coordinator can be tuned by setting the configurations with prefix <code>group.coordinator</code>.
        </li>
        <li>
            The Next Generation of the Consumer Rebalance Protocol (<a href="https://cwiki.apache.org/confluence/x/HhD1D">KIP-848</a>)
            is now Generally Available (GA) in Apache Kafka 4.0. The protocol is automatically enabled on the server when the upgrade to 4.0 is finalized.
            Note that once the new protocol is used by consumer groups, the cluster can only be downgraded to version 3.4.1 or newer.
            For more information check <a href="/{{version}}/documentation.html#consumer_rebalance_protocol">here</a>.
        </li>
        <li>
            Transactions Server-Side Defense (<a href="https://cwiki.apache.org/confluence/x/B40ODg">KIP-890</a>)
            brings a strengthened transactional protocol to Apache Kafka 4.0. The new and improved transactional protocol is enabled when the upgrade to 4.0 is finalized.
            When using 4.0 producer clients, the producer epoch is bumped on every transaction to ensure every transaction includes the intended messages and duplicates are not
            written as part of the next transaction. Downgrading the protocol is safe. For more information check <a href="/{{version}}/documentation.html#transaction_protocol">here</a>.
        </li>
        <li>
            Eligible Leader Replicas (<a href="https://cwiki.apache.org/confluence/x/mpOzDw">KIP-966 Part 1</a>)
            enhances the replication protocol for the Apache Kafka 4.0. Now the KRaft controller keeps track of the data partition replicas that are
            not included in ISR but are safe to be elected as leader without data loss. Such replicas are stored in the partition metadata as
            the <code>Eligible Leader Replicas</code>(ELR).
            For more information check <a href="/{{version}}/documentation.html#eligible_leader_replicas">here</a>.
        </li>
        <li>
            Since Apache Kafka 4.0.0, we have added a system property (<code>org.apache.kafka.sasl.oauthbearer.allowed.urls</code>) to
            set the allowed URLs as SASL OAUTHBEARER token or jwks endpoints. By default, the value is an empty list.
            Users should explicitly set the allowed list if necessary.
        </li>
        <li>A number of deprecated classes, methods, configurations and tools have been removed.
            <ul>
                <li><a id="upgrade_400_notable_common" href="#upgrade_400_notable_common"><b>Common</b></a>
                    <ul>
                        <li>The <code>metrics.jmx.blacklist</code> and <code>metrics.jmx.whitelist</code> configurations were removed from the <code>org.apache.kafka.common.metrics.JmxReporter</code>
                            Please use <code>metrics.jmx.exclude</code> and <code>metrics.jmx.include</code> respectively instead.
                        </li>
                        <li>The <code>auto.include.jmx.reporter</code> configuration was removed. The <code>metric.reporters</code> configuration
                            is now set to <code>org.apache.kafka.common.metrics.JmxReporter</code> by default.
                        </li>
                        <li>The constructor <code>org.apache.kafka.common.metrics.JmxReporter</code> with string argument was removed.
                            See <a href="https://cwiki.apache.org/confluence/x/SxIRCQ">KIP-606</a> for details.
                        </li>
                        <li>The <code>bufferpool-wait-time-total</code>, <code>io-waittime-total</code>, and <code>iotime-total</code> metrics were removed.
                            Please use <code>bufferpool-wait-time-ns-total</code>, <code>io-wait-time-ns-total</code>, and <code>io-time-ns-total</code> metrics as replacements, respectively.
                        </li>
                        <li>The <code>kafka.common.requests.DescribeLogDirsResponse.LogDirInfo</code> class was removed. Please use the <code>kafka.clients.admin.DescribeLogDirsResult.descriptions()</code> class
                            and <code>kafka.clients.admin.DescribeLogDirsResult.allDescriptions()</code> instead.
                        </li>
                        <li>The <code>kafka.common.requests.DescribeLogDirsResponse.ReplicaInfo</code> class was removed. Please use the <code>kafka.clients.admin.DescribeLogDirsResult.descriptions()</code> class
                            and <code>kafka.clients.admin.DescribeLogDirsResult.allDescriptions()</code> instead.
                        </li>
                        <li>The <code>org.apache.kafka.common.security.oauthbearer.secured.OAuthBearerLoginCallbackHandler</code> class was removed.
                            Please use the <code>org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginCallbackHandler</code> class instead.
                        </li>
                        <li>The <code>org.apache.kafka.common.security.oauthbearer.secured.OAuthBearerValidatorCallbackHandler</code> class was removed.
                            Please use the <code>org.apache.kafka.common.security.oauthbearer.OAuthBearerValidatorCallbackHandler</code> class instead.
                        </li>
                        <li>The <code>org.apache.kafka.common.errors.NotLeaderForPartitionException</code> class was removed. The <code>org.apache.kafka.common.errors.NotLeaderOrFollowerException</code> is returned
                            if a request could not be processed because the broker is not the leader or follower for a topic partition.
                        </li>
                        <li>The <code>org.apache.kafka.clients.producer.internals.DefaultPartitioner</code> and <code>org.apache.kafka.clients.producer.UniformStickyPartitioner</code> classes were removed.
                        </li>
                        <li>The <code>log.message.format.version</code> and <code>message.format.version</code> configs were removed.
                        </li>
                        <li>The function <code>onNewBatch</code> in <code>org.apache.kafka.clients.producer.Partitioner</code> class was removed.
                        </li>
                        <li>The default properties files for KRaft mode are no longer stored in the separate <code>config/kraft</code> directory since Zookeeper has been removed. These files have been consolidated with other configuration files.
                            Now all configuration files are in <code>config</code> directory.
                        </li>
                        <li>The valid format for <code>--bootstrap-server</code> only supports comma-separated value, such as <code>host1:port1,host2:port2,...</code>.
                            Providing other formats, like space-separated bootstrap servers (e.g., <code>host1:port1 host2:port2 host3:port3</code>), will result in an exception, even though this was allowed in Apache Kafka versions prior to 4.0.
                        </li>
                    </ul>
                </li>
                <li><a id="upgrade_400_notable_broker" href="#upgrade_400_notable_broker"><b>Broker</b></a>
                    <ul>
                        <li>The <code>delegation.token.master.key</code> configuration was removed.
                            Please use <code>delegation.token.secret.key</code> instead.
                        </li>
                        <li>
                            The <code>offsets.commit.required.acks</code> configuration was removed.
                            See <a href="https://cwiki.apache.org/confluence/x/9YobEg">KIP-1041</a> for details.
                        </li>
                        <li>The <code>log.message.timestamp.difference.max.ms</code> configuration was removed.
                            Please use <code>log.message.timestamp.before.max.ms</code> and <code>log.message.timestamp.after.max.ms</code> instead.
                            See <a href="https://cwiki.apache.org/confluence/x/thQ0Dw">KIP-937</a> for details.
                        </li>
                        <li>
                            The <code>remote.log.manager.copier.thread.pool.size</code> configuration default value was changed to 10 from -1.
                            Values of -1 are no longer valid; a minimum value of 1 or higher is required.
                            See <a href="https://cwiki.apache.org/confluence/x/FAqpEQ">KIP-1030</a>
                        </li>
                        <li>
                            The <code>remote.log.manager.expiration.thread.pool.size</code> configuration default value was changed to 10 from -1.
                            Values of -1 are no longer valid; a minimum value of 1 or higher is required.
                            See <a href="https://cwiki.apache.org/confluence/x/FAqpEQ">KIP-1030</a>
                        </li>
                        <li>
                            The <code>remote.log.manager.thread.pool.size</code> configuration default value was changed to 2 from 10.
                            See <a href="https://cwiki.apache.org/confluence/x/FAqpEQ">KIP-1030</a>
                        </li>
                        <li>
                            The minimum <code>segment.bytes/log.segment.bytes</code> has changed from 14 bytes to 1MB.
                            See <a href="https://cwiki.apache.org/confluence/x/FAqpEQ">KIP-1030</a>
                        </li>
                    </ul>
                </li>
                <li><a id="upgrade_400_notable_MirrorMaker" href="#upgrade_400_notable_MirrorMaker"><b>MirrorMaker</b></a>
                    <ul>
                        <li>The original MirrorMaker (MM1) and related classes were removed. Please use the Connect-based
                            MirrorMaker (MM2), as described in the <a href="/{{version}}/documentation/#georeplication">Geo-Replication section.</a>.
                        </li>
                        <li>The <code>use.incremental.alter.configs</code> configuration was removed from <code>MirrorSourceConnector</code>.
                            The modified behavior is now identical to the previous <code>required</code> configuration, therefore users should ensure that brokers in the target cluster are at least running 2.3.0.
                        </li>
                        <li>The <code>add.source.alias.to.metrics</code> configuration was removed from <code>MirrorSourceConnector</code>.
                            The source cluster alias is now always added to the metrics.
                        </li>
                        <li>The <code>config.properties.blacklist</code> was removed from the <code>org.apache.kafka.connect.mirror.MirrorSourceConfig</code>
                            Please use <code>config.properties.exclude</code> instead.
                        </li>
                        <li>The <code>topics.blacklist</code> was removed from the <code>org.apache.kafka.connect.mirror.MirrorSourceConfig</code>
                            Please use <code>topics.exclude</code> instead.
                        </li>
                        <li>The <code>groups.blacklist</code> was removed from the <code>org.apache.kafka.connect.mirror.MirrorSourceConfig</code>
                            Please use <code>groups.exclude</code> instead.
                        </li>
                    </ul>
                </li>
                <li><a id="upgrade_400_notable_tools" href="#upgrade_400_notable_tools"><b>Tools</b></a>
                    <ul>
                        <li>The <code>kafka.common.MessageReader</code> class was removed. Please use the
                            <a href="/{{version}}/javadoc/org/apache/kafka/tools/api/RecordReader.html"><code>org.apache.kafka.tools.api.RecordReader</code></a>
                            interface to build custom readers for the <code>kafka-console-producer</code> tool.
                        </li>
                        <li>The <code>kafka.tools.DefaultMessageFormatter</code> class was removed. Please use the <code>org.apache.kafka.tools.consumer.DefaultMessageFormatter</code> class instead.
                        </li>
                        <li>The <code>kafka.tools.LoggingMessageFormatter</code> class was removed. Please use the <code>org.apache.kafka.tools.consumer.LoggingMessageFormatter</code> class instead.
                        </li>
                        <li>The <code>kafka.tools.NoOpMessageFormatter</code> class was removed. Please use the <code>org.apache.kafka.tools.consumer.NoOpMessageFormatter</code> class instead.
                        </li>
                        <li>The <code>--whitelist</code> option was removed from the <code>kafka-console-consumer</code> command line tool.
                            Please use <code>--include</code> instead.
                        </li>
                        <li>Redirections from the old tools packages have been removed:
                            <code>kafka.admin.FeatureCommand</code>,
                            <code>kafka.tools.ClusterTool</code>,
                            <code>kafka.tools.EndToEndLatency</code>,
                            <code>kafka.tools.StateChangeLogMerger</code>,
                            <code>kafka.tools.StreamsResetter</code>,
                            <code>kafka.tools.JmxTool</code>.
                        </li>
                        <li>The <code>--authorizer</code>, <code>--authorizer-properties</code>, and <code>--zk-tls-config-file</code> options were removed from the <code>kafka-acls</code> command line tool.
                            Please use <code>--bootstrap-server</code> or <code>--bootstrap-controller</code> instead.
                        </li>
                        <li>
                            The <code>kafka.serializer.Decoder</code> trait was removed, please use the
                            <a href="/{{version}}/javadoc/org/apache/kafka/tools/api/Decoder.html"><code>org.apache.kafka.tools.api.Decoder</code></a>
                            interface to build custom decoders for the <code>kafka-dump-log</code> tool.
                        </li>
                        <li>The <code>kafka.coordinator.group.OffsetsMessageFormatter</code> class was removed. Please use the <code>org.apache.kafka.tools.consumer.OffsetsMessageFormatter</code> class instead.
                        </li>
                        <li>The <code>kafka.coordinator.group.GroupMetadataMessageFormatter</code> class was removed. Please use the <code>org.apache.kafka.tools.consumer.GroupMetadataMessageFormatter</code> class instead.
                        </li>
                        <li>The <code>kafka.coordinator.transaction.TransactionLogMessageFormatter</code> class was removed. Please use the <code>org.apache.kafka.tools.consumer.TransactionLogMessageFormatter</code> class instead.
                        </li>
                        <li>The <code>--topic-white-list</code> option was removed from the <code>kafka-replica-verification</code> command line tool.
                            Please use <code>--topics-include</code> instead.
                        </li>
                        <li>The <code>--broker-list</code> option was removed from the <code>kafka-verifiable-consumer</code> command line tool.
                            Please use <code>--bootstrap-server</code> instead.
                        </li>
                        <li><code>kafka-configs.sh</code> now uses incrementalAlterConfigs API to alter broker configurations instead of the deprecated alterConfigs API,
                            and it will fall directly if the broker doesn't support incrementalAlterConfigs API, which means the broker version is prior to 2.3.x.
                            See <a href="https://cwiki.apache.org/confluence/x/wIn5E">KIP-1011</a> for more details.
                        </li>
                        <li>The <code>kafka.admin.ZkSecurityMigrator</code> tool was removed.
                        </li>
                    </ul>
                </li>
                <li><a id="upgrade_400_notable_connect" href="#upgrade_400_notable_connect"><b>Connect</b></a>
                    <ul>
                        <li>The <code>whitelist</code> and <code>blacklist</code> configurations were removed from the <code>org.apache.kafka.connect.transforms.ReplaceField</code> transformation.
                            Please use <code>include</code> and <code>exclude</code> respectively instead.
                        </li>
                        <li>The <code>onPartitionsRevoked(Collection&lt;TopicPartition&gt;)</code> and <code>onPartitionsAssigned(Collection&lt;TopicPartition&gt;)</code> methods
                            were removed from <code>SinkTask</code>.
                        </li>
                        <li>The <code>commitRecord(SourceRecord)</code> method was removed from <code>SourceTask</code>.
                        </li>
                    </ul>
                </li>
                <li><a id="upgrade_400_notable_consumer" href="#upgrade_400_notable_consumer"><b>Consumer</b></a>
                    <ul>
                        <li>The <code>poll(long)</code> method was removed from the consumer. Please use <code>poll(Duration)</code> instead. Note that there is
                            a difference in behavior between the two methods. The <code>poll(Duration)</code> method does not block beyond the timeout awaiting
                            partition assignment, whereas the earlier <code>poll(long)</code> method used to wait beyond the timeout.
                        </li>
                        <li>The <code>committed(TopicPartition)</code> and <code>committed(TopicPartition, Duration)</code> methods were removed from the consumer.
                            Please use <code>committed(Set&lt;TopicPartition&gt;)</code> and <code>committed(Set&lt;TopicPartition&gt;, Duration)</code> instead.
                        </li>
                        <li>
                            The <code>setException(KafkaException)</code> method was removed from the <code>org.apache.kafka.clients.consumer.MockConsumer</code>.
                            Please use <code>setPollException(KafkaException)</code> instead.
                        </li>
                    </ul>
                </li>
                <li><a id="upgrade_400_notable_producer" href="#upgrade_400_notable_producer"><b>Producer</b></a>
                    <ul>
                        <li>The <code>enable.idempotence</code> configuration will no longer automatically fall back when the <code>max.in.flight.requests.per.connection</code> value exceeds 5.
                        </li>
                        <li>The deprecated <code>sendOffsetsToTransaction(Map&lt;TopicPartition, OffsetAndMetadata&gt;, String)</code> method has been removed from the Producer API.
                        </li>
                        <li>The default <code>linger.ms</code> changed from 0 to 5 in Apache Kafka 4.0 as the efficiency gains from larger batches typically result in
                            similar or lower producer latency despite the increased linger.
                        </li>
                    </ul>
                </li>
                <li><a id="upgrade_400_notable_admin_client" href="#upgrade_400_notable_admin_client"><b>Admin client</b></a>
                    <ul>
                        <li>
                            The <code>alterConfigs</code> method was removed from the <code>org.apache.kafka.clients.admin.Admin</code>.
                            Please use <code>incrementalAlterConfigs</code> instead.
                        </li>
                        <li>The <code>org.apache.kafka.common.ConsumerGroupState</code> enumeration and related methods have been deprecated. Please use <code>GroupState</code> instead
                            which applies to all types of group.
                        </li>
                        <li>The <code>Admin.describeConsumerGroups</code> method used to return a <code>ConsumerGroupDescription</code> in state
                            <code>DEAD</code> if the group ID was not found. In Apache Kafka 4.0, the <code>GroupIdNotFoundException</code>
                            is thrown instead as part of the support for new types of group.
                        </li>
                        <li>The <code>org.apache.kafka.clients.admin.DeleteTopicsResult.values()</code> method was removed.
                            Please use <code>org.apache.kafka.clients.admin.DeleteTopicsResult.topicNameValues()</code> instead.
                        <li>The <code>org.apache.kafka.clients.admin.TopicListing.TopicListing(String, boolean)</code> method was removed.
                            Please use <code>org.apache.kafka.clients.admin.TopicListing.TopicListing(String, Uuid, boolean)</code> instead.
                        </li>
                        <li>The <code>org.apache.kafka.clients.admin.ListConsumerGroupOffsetsOptions.topicPartitions(List&lt;TopicPartition&gt;)</code> method was removed.
                            Please use <code>org.apache.kafka.clients.admin.Admin.listConsumerGroupOffsets(Map&lt;String, ListConsumerGroupOffsetsSpec&gt;, ListConsumerGroupOffsetsOptions)</code> instead.
                        </li>
                        <li>
                            The deprecated <code>dryRun</code> methods were removed from the <code>org.apache.kafka.clients.admin.UpdateFeaturesOptions</code>.
                            Please use <code>validateOnly</code> instead.
                        </li>
                        <li>The constructor <code>org.apache.kafka.clients.admin.FeatureUpdate</code> with short and boolean arguments was removed.
                            Please use the constructor that accepts short and the specified <code>UpgradeType</code> enum instead.
                        </li>
                        <li>
                            The <code>allowDowngrade</code> method was removed from the <code>org.apache.kafka.clients.admin.FeatureUpdate</code>.
                        </li>
                        <li>The <code>org.apache.kafka.clients.admin.DescribeTopicsResult.DescribeTopicsResult(Map&lt;String, KafkaFuture&lt;TopicDescription&gt;&gt;)</code> method was removed.
                            Please use <code>org.apache.kafka.clients.admin.DescribeTopicsResult.DescribeTopicsResult(Map&lt;Uuid, KafkaFuture&lt;TopicDescription&gt;&gt;, Map&lt;String, KafkaFuture&lt;TopicDescription&gt;&gt;)</code> instead.
                        </li>
                        <li>
                            The <code>values()</code> method was removed from the <code>org.apache.kafka.clients.admin.DescribeTopicsResult</code>.
                            Please use <code>topicNameValues()</code> instead.
                        </li>
                        <li>
                            The <code>all()</code> method was removed from the <code>org.apache.kafka.clients.admin.DescribeTopicsResult</code>.
                            Please use <code>allTopicNames()</code> instead.
                        </li>
                    </ul>
                </li>
                <li><a id="upgrade_400_notable_kafka_streams" href="#upgrade_400_notable_kafka_streams"><b>Kafka Streams</b></a>
                    <ul>
                        <li>
			    All public APIs, deprecated in Apache Kafka 3.6 or an earlier release, have been removed, with the exception of <code>JoinWindows.of()</code> and <code>JoinWindows#grace()</code>.
			    See <a href="https://issues.apache.org/jira/browse/KAFKA-17531">KAFKA-17531</a> for details.
                        </li>
                        <li>
                            The most important changes are highlighted in the <a href="/{{version}}/documentation/streams/upgrade-guide.html#streams_api_changes_400">Kafka Streams upgrade guide</a>.
                        </li>
                        <li>
                            For a full list of changes, see <a href="https://issues.apache.org/jira/browse/KAFKA-12822">KAFKA-12822</a>.
                        </li>
                        <li>
                            If you are using <code>KStream#transformValues()</code> which was removed with Apache Kafka 4.0.0 release,
                            and you need to rewrite your program to use <code>KStreams#processValues()</code> instead,
                            pay close attention to the <a href="/{{version}}/documentation/streams/developer-guide/dsl-api.html#transformers-removal-and-migration-to-processors">migration guide</a>.
                        </li>
                    </ul>
                </li>
            </ul>
        </li>
        <li>Other changes:
            <ul>
                <li>
                    The minimum Java version required by clients and Kafka Streams applications has been increased from Java 8 to Java 11
                    while brokers, connect and tools now require Java 17.
                    See <a href="https://cwiki.apache.org/confluence/x/P4vOCg">KIP-750</a> and
                    <a href="https://cwiki.apache.org/confluence/x/Bov5E">KIP-1013</a> for more details.
                </li>
                <li>
                    Java 23 support has been added in Apache Kafka 4.0.
                </li>
                <li>
                    Scala 2.12 support has been removed in Apache Kafka 4.0.
                    See <a href="https://cwiki.apache.org/confluence/x/OovOCg">KIP-751</a> for more details
                </li>
                <li>
                    Logging framework has been migrated from Log4j to Log4j2.
                    Users can use the log4j-transform-cli tool to automatically convert their existing Log4j configuration files to Log4j2 format.
                    See <a href="https://logging.staged.apache.org/log4j/transform/cli.html#log4j-transform-cli">log4j-transform-cli</a> for more details.
                    Log4j2 provides limited compatibility for Log4j configurations.
                    See <a href="https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#ConfigurationCompatibility">Use Log4j 1 to Log4j 2 bridge</a> for more information,
                </li>
                <li>
                    KafkaLog4jAppender has been removed, users should migrate to the log4j2 appender
                    See <a href="https://logging.apache.org/log4j/2.x/manual/appenders.html#KafkaAppender">KafkaAppender</a> for more details
                </li>
                <li>
                    The <code>--delete-config</code> option in the <code>kafka-topics</code> command line tool has been deprecated.
                </li>
                <li>
                    For implementors of RemoteLogMetadataManager (RLMM), a new API <code>nextSegmentWithTxnIndex</code> is
                    introduced in RLMM to allow the implementation to return the next segment metadata with a transaction
                    index. This API is used when the consumers are enabled with isolation level as READ_COMMITTED.
                    See <a href="https://cwiki.apache.org/confluence/x/BwuTEg">KIP-1058</a> for more details.
                </li>
                <li>
                    The criteria for identifying internal topics in ReplicationPolicy and DefaultReplicationPolicy have
                    been updated to enable the replication of topics that appear to be internal but aren't truly internal to Kafka and Mirror Maker 2.
                    See <a href="https://cwiki.apache.org/confluence/x/jA3OEg">KIP-1074</a> for more details.
                </li>
                <li>
                    <a href="https://cwiki.apache.org/confluence/x/2xRRCg">KIP-714</a> is now enabled for Kafka Streams via <a href="https://cwiki.apache.org/confluence/x/XA-OEg">KIP-1076</a>.
		    This allows to not only collect the metric of the internally used clients of a Kafka Streams application via a broker-side plugin,
		    but also to collect the <a href="/{{version}}/documentation/#kafka_streams_monitoring">metrics</a> of the Kafka Streams runtime itself.
            </li>
                <li>
                    The default value of <code>num.recovery.threads.per.data.dir</code> has been changed from 1 to 2. The impact of this is faster
                    recovery post unclean shutdown at the expense of extra IO cycles.
                    See <a href="https://cwiki.apache.org/confluence/x/FAqpEQ">KIP-1030</a>
                </li>
                <li>
                    The default value of <code>message.timestamp.after.max.ms</code> has been changed from Long.Max to 1 hour. The impact of this messages with a
                    timestamp of more than 1 hour in the future will be rejected when message.timestamp.type=CreateTime is set.
                    See <a href="https://cwiki.apache.org/confluence/x/FAqpEQ">KIP-1030</a>
                </li>
                <li>Introduced in <a href="https://cwiki.apache.org/confluence/x/B40ODg">KIP-890</a>, the <code>TransactionAbortableException</code> enhances error handling within transactional operations by clearly indicating scenarios where transactions should be aborted due to errors. It is important for applications to properly manage both <code>TimeoutException</code> and <code>TransactionAbortableException</code> when working with transaction producers.</li>
                <ul>
                    <li><b>TimeoutException:</b> This exception indicates that a transactional operation has timed out. Given the risk of message duplication that can arise from retrying operations after a timeout (potentially violating exactly-once semantics), applications should treat timeouts as reasons to abort the ongoing transaction.</li>
                    <li><b>TransactionAbortableException:</b> Specifically introduced to signal errors that should lead to transaction abortion, ensuring this exception is properly handled is critical for maintaining the integrity of transactional processing.</li>
                    <li>To ensure seamless operation and compatibility with future Kafka versions, developers are encouraged to update their error-handling logic to treat both exceptions as triggers for aborting transactions. This approach is pivotal for preserving exactly-once semantics.</li>
                    <li> See <a href="https://cwiki.apache.org/confluence/x/B40ODg">KIP-890</a> and
                    <a href="https://cwiki.apache.org/confluence/x/8ItyEg">KIP-1050</a> for more details </li>
                </ul>
                <li>
                    The filename for rotated <code>state-change.log</code> files incorrectly rotates to <code>stage-change.log.[date]</code> (changing state to stage). This issue is corrected in 4.0.1.
                    See <a href="https://issues.apache.org/jira/browse/KAFKA-19576">KAFKA-19576</a> for details.
                </li>
            </ul>
        </li>
    </ul>

<h4><a id="upgrade_3_9_0" href="#upgrade_3_9_0">Upgrading to 3.9.0 and older versions</a></h4>

<p>See <a href="/39/documentation/#upgrade">Upgrading From Previous Versions</a> in the 3.9 documentation.</p>

</script>

<div class="p-upgrade"></div>
